package com.project.base.hdfs;

import com.project.base.common.Constants;
import com.project.base.core.hdfs.HdfsHelper;
import com.project.base.core.tables.RequestTimeDetail;
import org.apache.hadoop.fs.FSDataOutputStream;

import java.io.IOException;


public class ApiRequestTimeDetailHdfsHelper extends HdfsHelper {
    private static final long serialVersionUID = -7947448579207499010L;
    public static final String TABLE_NAME = "API_REQUEST_TIME_DETAIL";

    @Override
    public void save(FSDataOutputStream outputStream, Object obj) {
        if (!(obj instanceof RequestTimeDetail)) {
            return;
        }
        RequestTimeDetail entity = (RequestTimeDetail) obj;
        String entityStr = entity.toLogStr(Constants.SEPERATOR);
        try {
            outputStream.writeUTF(entityStr);
            outputStream.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    protected String getTableName() {
        return TABLE_NAME;
    }

}
